<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>登录页面</title>
</head>
<body>
<center>
    <form action="do_login.php" method="post">
        <table>
            <tr align="center">
                <td>
                    <h2>登录</h2>
                </td>
            </tr>
            <tr align="center">
                <td>
                    <input type="text" placeholder="请输入手机号" name="sjh" id="sjh">
                </td>
            </tr>
            <tr align="center">
                <td>
                    <input type="text" placeholder="请输入密码" name="pwd" id="pwd">
                </td>
            </tr>
            <tr align="center">
                <td>
                    <input type="submit" value="登录">
                </td>
            </tr>
        </table>
    </form>
</center>
</body>
</html>
<script src="jquery.js"></script>
<script>
    $(document).on('blur','#sjh',function () {
        var v=$(this).val();
        var par = /^(13|15|17|18)\d{9}$/.test(v);
        if(!par)
        {
            alert('格式不对');
        }
    })
    $(document).on('blur','#pwd',function () {
        var v=$(this).val();
        var par = /^\w{6,}$/.test(v);
        if(!par)
        {
            alert('格式不对');
        }
    })
</script>